/*
https://leetcode-cn.com/problems/find-all-numbers-disappeared-in-an-array/solution/zhao-dao-suo-you-shu-zu-zhong-xiao-shi-d-mabl/
 */
import java.util.ArrayList;
import java.util.List;

public class Solution448 {
    public List<Integer> findDisappearedNumbers(int[] nums) {
        int n=nums.length;
        for (int i=0;i<n;i++){
            nums[(nums[i]-1)%n]+=n;
        }
        List<Integer> list=new ArrayList<>();
        for(int i=0;i<n;i++){
            if (nums[i]<=n){
                list.add(i+1);
            }
        }
        return list;
    }

    public static void main(String[] args) {
        System.out.println(new Solution448().findDisappearedNumbers(new int[]{4,3,2,7,8,2,3,1}));
    }
}
